package day07.dao.impl;

import day07.dao.UserDao;
import day07.entity.User;
import day07.utils.JDBCUtils;

import java.sql.Connection;
import java.util.List;

public class UserDaoImpl implements UserDao {

    @Override
    public int save(Connection connection, String s, Long id, String name, String password, String address) {
        return JDBCUtils.insert(connection, s, id, name, password, address);
    }

    @Override
    public User queryById(Connection connection, String s, Class<User> userClass, Long id) {
        return JDBCUtils.queryById(connection, s, userClass, id);
    }

    @Override
    public int update(Connection connection, String s, String name, String password, String address, Long id) {
        return JDBCUtils.update(connection, s, name, password, address, id);
    }

    @Override
    public int delete(Connection connection, String s, Long id) {
        return JDBCUtils.delete(connection, s, id);
    }

    @Override
    public List<User> queryAll(Connection connection, String s) {
        return JDBCUtils.query(connection, s, User.class);
    }
}
